Obstructions for bounded shrub-depth and rank-depth