New characterization of magnetic Sobolev spaces