Convex Optimization Algorithms and Statistical Bounds for Learning Structured Models