Search for high-mass resonances decaying to dilepton final states in pp collisions at $\sqrt{s}=7$ TeV with the ATLAS detector