If you add a caption field to your files in your blueprint, this generates a form for the file in the panel, where you can then add your caption. Of course, if you don’t add anything, nothing can be displayed. You might want to have a look at this post Adding metadata files for images within the panel.
Other than that, I don’t really understand what you mean by “automatically”…
[Edit] The tags.php adds a caption to your file if you add a Kirbytags to your fields like this:
(image: image.jpg caption: Some caption text)