This is an example of how to auto-tile sprites using an array and a bitwise method explained here:
Please Note: With the addition of the tilemap plugin, it is highly recommended that you use the tilemap object for auto-tiling whenever possible as it requires less processing power than creating individual sprites. This tutorial is for when you require features that the tilemap plugin does not have (i.e. multiple frames/animations, rotation, etc).
Here is a nice example of how to achieve auto-tiling with the tilemap object. Thanks to Joannesalfa and R0j0hound for the tilemap example.