regression/correlation for classified data

#1
Hi,

I have classified data regarding income. Besides, I have a 7-point Likert scale where people express their favor toward mobility management measures. See the attached picture.

My question is whether I can correlate classes with the Likert scale that way. IT's simply the Excel trendline, also R^2 is given. So I can obtain r while the slope is given in the equation telling me whether r is +/-.

Can I do it in such a simple way or is it factually wrong? Limitations on the approach are ok as long as I discuss them later. However, I dont know whether it is allowed to correlate classes with the function given in Excel.

Another question: can I see the function/formula somewhere? What is Excel doing?
------------------

The picture shows the income classes. In each class there are n respondents. Y shows the average Likert score in that class. So I correlate an average score with income classes.