Adaptive Principal Component Regression with Applications to Panel Data