How to determine the correlation using $X^2$ values

I am trying to understand how to calculate the correlation between two variables using p values. I am familiar with using the classic $$X^2$$ formula from the The Morgan Kaufmann series in data mining. The formula described in the text uses the expected frequency and observed frequency. To calculate the $$X^2$$ value. Then the $$X^2$$ value is compared with the significance level to determine if the variables are correlated. However, this example uses p-values.

The table above shows the contingency table for a set of values and the table below shows the p-values

How can I determine if the two variables are correlated? Any help would be greatly appreciated.