Electrically, they are both correct. However, I would consider it good practice to install the resistor to the output pin and the LED to the ground pin. The reason being that, if you screw up part of your hook-up there is a good chance the resistor will still , provide current limitation protection to your arduino.