OS devices can only print directly to AirPrint printers, and the HP Deskjet 4580 isn't one.
To print directly from an iPad / iPhone you will need an AirPrint - enabled printer or another device to act as a print server. That can be a Mac running Printopia ($19.95 with free trial) or handyPrint (donation - supported). The Mac must be "on" but may be asleep for them to work. Equivalent PC options may exist but you're on your own finding them.
You can also buy this standalone print server:
These options enable you to use any printer available to your network, even older ones that may predate AirPrint by decades.
Otherwise you will need to buy an AirPrint printer or multifunction device.