Statistical learning for predicting density–matrix-based electron dynamics