Dynamics of the Hubbard model: A general approach by the time-dependent variational principle