We consider the estimation of dynamic panel data models in the presence of incidental parameters in both dimensions: individual fixed-effects and time fixed-effects, as well as incidental parameters in the variances. We adopt the factor analytical approach by estimating the sample variance of individual effects rather than the effects themselves. In the presence of cross-sectional heteroskedasticity, the factor method estimates the average of the cross-sectional variances instead of the individual variances. The method thereby eliminates the incidental-parameter problem in the means and in the variances over the cross-sectional dimension. We further show that estimating the time effects and heteroskedasticities in the time dimension does not lead to the incidental-parameter bias even when T and N are comparable. Moreover, efficient and robust estimation is obtained by jointly estimating heteroskedasticities.