Prompt and non-prompt J/ψ production in pp collisions at $\sqrt{s} = 7$ TeV