You can, but pre-shredded carrots tend to be hard and dry. Fresh grated carrots contain a lot of moisture, which results in a more moist cake. Plus, grated pieces are thinner and incorporate better in the batter for a final cake with a smoother texture than if you used chunkier shredded carrots.