I wonder if R-squared can be deemed a function of the correlation matrix (or the variance-covariance matrix)?

The only ways to compute the R-squared I know are

1. the correlation coefficient between the predicted values (y_hat) and the observations (y)

2. 1 - SSE/SST

What can I do if I want to compute R-squared but have in hand only the correlation matrix and sample size?

Thanks in advance!!