The ECHO code for astrophysical plasmas: Special and General Relativistic MHD