How Can a Volcano Erupt Mafic Lava One Time, and Then Felsic Lava Another Time?

There are several ways, but one of the common ones happens when the magma in a magma chamber has time to separate (called "differentiation" ). Just like lighter grease will bubble to the top of a pan of spaghetti sauce, so will felsic magma bubble upwards in a magma chamber.

So what you can get is a violent felsic explosion, followed by an intermediate or mafic eruption after the pressure is released and magma from deeper in the magma chamber can be released. For example: Crater Lake in Oregon. The initial eruption blew off the top of Mt. Mazama and made the hole for Crater Lake, but then a mafic cinder cone erupted inside the caldera and formed Wizard Island.