It depends. You are free to drive as long as your vision goes back to normal again. But, before that, you had better not drive. And I don' t think you dare to drive when you are still having a blurry vision, which is definitely risking your life. Usually, this situation will just take hours. It won' t take too long. By the way, even your eyes have already recovered, you still need to take more rest before driving, because it is said that human eyes will become very sensitive to the light after eye dilation and there may be some blind spot if their eyes are exposed to the light after that. What is more interesting, if you have light colored eyes, it will take longer before you can drive.
You'd better not drive when you have dilated eyes for the sake of your eyes health. As we know, When you get dilated pupils, it is difficult to get smaller in a short time that block out light in bright area, thus you can't see things clearly up close. But it won't affect your distance vision. If you drive this time, you may feel difficult to see dashboard of your car. That will be dangerous. And as long as your eyes recover from dilated eyes, you can drive as normal.