Stochastic Gradient Descent, Weighted Sampling, and the Randomized Kaczmarz algorithm