Dynamic population gratings (DPGs) in rare-earth doped fibers are prevalent devices in fiber lasers for the production of single-longitudinal-mode emission, Q-switched pulses, and wavelength self-sweeping regimes. This study presents a transition from Q-switched state to continuous wave (CW) state, accompanying irregular mode-hopping, in an erbium-doped fiber laser with a heavily-doped DPG centered at 1549.95 nm. Our results demonstrate that the transition between these two states can be achieved by adjusting the pump power. The repetition frequency of the Q-switched pulse increases monotonically with the increasing pump power, while the pulse duration initially narrows and then expands because the reduced peak intensity weakens the nonlinear effect. Additionally, modulation peaks are evident on both the Q-switched pulse train and the CW background, which are induced by the irregular mode-hopping caused by the DPG. Furthermore, we observe that the central wavelength fluctuates within a range of 0.05 nm. These results provide valuable insight into the DPG effect in heavily-doped fibers.