ECHO: a Eulerian conservative high-order scheme for general relativistic magnetohydrodynamics and magnetodynamics