We present an application of our new theoretical formulation of quantum dynamics, moment propagation theory (MPT) (Boyer et al., J. Chem. Phys. 160, 064113 (2024)), for employing machine-learning techniques to simulate the quantum dynamics of electrons. In particular, we use real-time time-dependent density functional theory (RT-TDDFT) simulation in the gauge of the maximally localized Wannier functions (MLWFs) for training the MPT equation of motion. Spatially localized time-dependent MLWFs provide a concise representation that is particularly convenient for the MPT expressed in terms of increasing orders of moments. The equation of motion for these moments can be integrated in time, while the analytical expressions are quite involved. In this work, machine-learning techniques were used to train the second-order time derivatives of the moments using first-principles data from the RT-TDDFT simulation, and this MPT enabled us to perform electron dynamics efficiently. The application to computing optical absorption spectrum for various systems was demonstrated as a proof-of-principles example of this approach. In addition to isolated molecules (water, benzene, and ethene), condensed matter systems (liquid water and crystalline silicon) were studied, and we also explored how the principle of the nearsightedness of electrons can be employed in this context.