SPARK-2281 [MLlib] Simplify the duplicate code in Gradient.scala

The Gradient.compute which returns new tuple of (gradient: Vector, loss: Double) can be constructed by in-place version of Gradient.compute. Thus, we don't need to maintain the duplicate code.