F1 - yes, since it is for educational purposes.
H1B - not so sure, since the example here mentions "essential" travelers who must travel between US and Canada due to the nature of their work, such as farming or agriculture...
If anyone has tried to do this recently, then that would be great to...