Long-term variability of the optical spectra of NGC 4151. I. Light curves and flux correlations