Learning Horizontal Connections in a Sparse Coding Model of Natural Images