Measurement of the atmospheric νe and νμ energy spectra with the ANTARES neutrino telescope