If you now connect the capacitor to a battery then the voltage $V$ is constant because the voltage is always just equal to the battery voltage. So now we have $Q = CV$, for constant $V$, and when you insert the dielectric it increases $C$ so $Q$ increases by the same factor of $\epsilon_r$.