Both are used to measure the model fit and consistency. In particular, R2 is a measure of model fit to the original data, and Q2 provides an internal measure of consistency between the original and cross-validation predicted data.
Both are optimistic measures without proper reference standards. It is generally inadequate to use only R2 and Q2 to assess model reliability. Double cross validation (using external cross validation) and permutation are highly recommended when sample size permits. For more details, read this excellent paper