No, I don't know a way, but I'm not a ZFS expert (just very satisfied user), and in particular I have never looked at the source code.
If you explain why you want to do that, maybe we can figure out something? AFAIK, the ARC and L2ARC only contain read caches (not dirty data a.k.a. write caches). So flushing them will not harden your data to disk, it will only affect performance and memory usage. Deliberately flushing read caches is not something that's commonly done in normal operation (yes, I know there are exceptions involving manually managing caches when the user knows more about application semantics than the file system can infer). It is often used as part of benchmarking, but that is a very dangerous way of creating biased benchmark numbers.