Dataset-learning duality and emergent criticality