Fourth post-Newtonian Hamiltonian dynamics of two-body systems from an effective field theory approach